﻿@model GameSchool.ViewModels.Course.EditRulesViewModel
@{
    ViewBag.Title = "Einkunnarvægi";
}
<h2>
    Einkunnarvægi prófa og verkefna fyrir @Model.courseRules.First().Course.Name
</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<table class="table table-striped">
    <tr>
        <th>
            Röðun
        </th>
        <th>
            Heiti
        </th>
        <th>
            Einkunnarvægi
        </th>
        <th>
            Lagfæringar
        </th>
    </tr>
    <tfoot>
        <tr>
            <td></td><!-- þessi er settur hérna tímabundið til að annað komi undir rétta dálka.-->
            <td>
                Samtals
            </td>
            <td>
                100%
            </td>
            <td>
                <a href="@Url.Action("Save" , "Course", new { id = Model.courseRules})" class="btn btn-mini">Vista</a>
            </td>
        </tr>
    </tfoot>
    @foreach (var item in Model.courseRules)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.SortOrder)
            </td>
            <td>
                @if (item.Project != null)
                {
                    @Html.DisplayFor(modelItem => item.Project.Name)
                }
                else
                {
                    @Html.DisplayFor(modelItem => item.Exam.Name)
                }
            </td>
            <td>
                @Html.TextBoxFor(modelItem => item.CourseID, new { @class="control-select span1"  })
            </td>
            <td>
                @if (item.Project != null)
                {
                    <a href="@Url.Action("Edit", "Project", new { id = item.ProjectID })" class="btn btn-mini">Breyta</a>
                    <a href="@Url.Action("Result", "Project", new { id = item.ProjectID })" class="btn btn-mini">Niðurstöður</a>
                }
                else
                {
                    <a href="@Url.Action("Edit", "Exam", new { id = item.ExamID })" class="btn btn-mini">Breyta</a>
                    <a href="@Url.Action("Result", "Exam",new { id = item.ExamID })" class="btn btn-mini">Niðurstöður</a>
                }
            </td>
        </tr>
    }
</table>

